<template>
	<view class="container">
		<view class="input-wrapper flex">
			<u-input class="input" v-model="value" type="text" />
		</view>
		<view class="common-btn submit-btn" @tap="modifyNickName">提交</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: ""
			};
		},
		methods: {
			async modifyNickName() {
				try {
					await this.$u.api.modifyNickNameApi({
						nickname: this.value
					})
					this.$Router.back()
				} catch (e) {
					//TODO handle the exception
				}

			}
		},
		async onLoad() {
			try{
				let res=await this.$u.api.personInfoApi()
				this.value=res.nickname
			}catch(e){
				//TODO handle the exception
			}
		}
	}
</script>

<style lang="scss">
	.container {
		.input-wrapper{
			padding:0 30rpx;
			background-color: #fff;
		}
		.input{
			flex:1;
			background-color: #fff;
		}
		.submit-btn{
			margin: 30rpx;
		}
	}
</style>
